<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html; UTF-8" pageEncoding="UTF-8" isELIgnored="false" %><!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>学生入学时间管理</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/back/statics/css/bootstrap3.min.css">
    <script src="${pageContext.request.contextPath}/back/statics/js/jquery-1.8.3.min.js"></script>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-4 col-sm-offset-4">
            <h1 class="text-center">班级入学时间管理</h1>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <table class="table table-striped table-bordered table-hover">
                <tr>
                    <th>编号</th>
                    <th>学生姓名</th>
                    <th>学生学号</th>
                    <th>所在班级</th>
                    <th>入学时间</th>
                    <th>早(晚)入学原因</th>
                    <th>操作</th>
                </tr>
                <c:forEach items="${requestScope.classes}" var="class">
                    <tr>
                        <td>${class.id}</td>
                        <td>${class.name}</td>
                        <td>${class.s_number}</td>
                        <td>${class.in_class}</td>
                        <td>${class.in_school_year}</td>
                        <td>${class.remarks}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/class/delete/${class.id}" class="btn btn-danger btn-sm">删除</a>
                            <a href="${pageContext.request.contextPath}/class/change/${class.id}" class="btn btn-primary btn-sm" >修改</a>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <form class="form-inline" id="input" action="${pageContext.request.contextPath}/class/save" method="post">
                <div class="form-group">
                    <label for="s_name">学生姓名:</label>
                    <input type="text" class="form-control" id="s_name" name="name" placeholder="请输学生姓名" >
                    <label for="s_number">学生学号:</label>
                    <input type="text" class="form-control" id="s_number" name="s_number" placeholder="请输学生学号" >
                    <label for="in_class">所在班级:</label>
                    <select name="in_class" id="in_class" class="form-control">
                        <option value="计算数据1871">计算数据1871</option>
                        <option value="计算数据1872">计算数据1872</option>
                    </select>
                    <div style="margin-top: 3px">
                        <label for="time">入学时间:</label>
                        <input type="text" class="form-control" id="time" name="in_school_year" placeholder="请输入入学时间">
                        <label for="remareks">早(晚)入学原因:</label>
                        <input type="text" class="form-control" id="remareks" name="remarks" placeholder="请输入相关原因">
                        <button type="submit" class="btn btn-success">添加信息</button>
                    </div>

                </div>

            </form>
        </div>
    </div>
</div>
</body>
</html>
<script>
    $(function (){
        $("#input").submit(function (){
            if (!$("#s_name").val()){
                alert("学生姓名不能为空");
                return false;
            }
            if (!$("#s_number").val()){
                alert("学生学号不能为空");
                return false;
            }
            if (!$("#in_class").val()){
                alert("所在班级名不能为空");
                return false;
            }
            if (!$("#time").val()){
                alert("入学时间不能为空");
                return false;
            }
        });
    })
</script>